<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
    let arr=[1,2,3,4,5]
    arr.splice(1,2,'aaa','bbb')
    console.log(arr)
    let arr1=arr.slice(2,4)
    console.log(arr1)
    let arr2=arr.slice(2)
    console.log(arr2)
    let arr3=["abc",'ert','qwe']
    let length=arr3.reduce((previous,current)=>{
        return previous +current.length
    },0)
    console.log("所有字符串总长度:", length);
    for(let i of arr){
        console.log(i)
    }
    for(let a=0;a<arr.length;a++){
          console.log(arr[a])
    }
    for(i in arr){
          console.log(arr[i])  
    }

    let obj={
        name:"zhangsan",
        age:18
    }
  obj.heigh=181
    function Person(){
        this.name="lisi"
        this.age=12
    }
    let obj2=new Person()
    console.log(obj2)
    function Person1(x,y,z){
        this.name=x
        this.age=y
        this.height=z
    }
    let obj4=new Person1("wangwu",20,190)
    console.log(obj4)
    obj4.ww=(a)=>{
        console.log(a)
    }
    obj4.ww("name")
    </script>

</body>
</html>